{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5845722b-afb4-47db-99ee-c59217552065",
   "metadata": {},
   "source": [
    "### Population Changes Since 1980\n",
    "\n",
    "The data shown below shows the decade-on-decade increases in the\n",
    "[world's population](https://www.worldometers.info/world-population/world-population-by-year/)\n",
    "since 1980."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4db0c4f2-ba67-4854-9f6b-2e2ca724971f",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calculate_differences(data_set):\n",
    "    differences = [\n",
    "        0,\n",
    "    ]\n",
    "    for index in range(1, len(data_set)):\n",
    "        differences.append(round(data_set[index] - data_set[index - 1], 1))\n",
    "    return differences\n",
    "\n",
    "\n",
    "population_change = calculate_differences(population)  # noqa: F821"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0822c8a4-829a-4806-b965-b2a88cf8798c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "zipped = list(zip(decades, population, population_change, strict=False))  # noqa: F821\n",
    "\n",
    "population_df = pd.DataFrame(\n",
    "    zipped, columns=(\"Decade\", \"Population(Bn)\", \"Change\")\n",
    ")\n",
    "\n",
    "print(population_df)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
